package yl.hs.bmipfull.controllers.dataCockpit;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import yl.hs.bmipfull.controllers.ControllerBase;
import yl.hs.bmipfull.service.dataCockpit.IFinancialDataService;
import yl.hs.bmipfull.service.finance.IReceiptSettleService;
import yl.hs.bmipfull.viewmodels.WebResult;

/**
 * @author 韩纪旺
 * @apiNote
 * @since 2022/9/22 17:13 创建
 */
@RequestMapping("/api/dataCockpit/FinancialDataController")
@Api(value = "数据驾驶舱--财务数据", tags = "数据驾驶舱--财务数据")
@RestController
public class FinancialDataController  extends ControllerBase {

    @Autowired
    IFinancialDataService service;


    @ApiOperation(value = "财务数据--销售量", notes = "销售量")
    @RequestMapping(value = "/salesVolume/{timeType}", method = RequestMethod.GET)
    public WebResult salesVolume(@ApiParam(value = "时间类型")@PathVariable String timeType) {
        return success("ok",service.getSalesVolume(timeType)) ;
    }

    @ApiOperation(value = "财务数据--产值", notes = "产值")
    @RequestMapping(value = "/outputValue/{timeType}", method = RequestMethod.GET)
    public WebResult outputValue(@ApiParam(value = "时间类型")@PathVariable String timeType) {
        return success("ok", service.getOutputValue(timeType));

    }

    @ApiOperation(value = "财务数据--月度产值", notes = "月度产值")
    @RequestMapping(value = "/monthlyOutputValue", method = RequestMethod.GET)
    public WebResult monthlyOutputValue() {
        return success("ok",service.getMonthlyOutputValue());
    }

    @ApiOperation(value = "财务数据--应收款/实收情况", notes = "应收款/实收情况")
    @RequestMapping(value = "/collection", method = RequestMethod.GET)
    public WebResult collection() {
        return success("ok", service.getCollection());

    }

    @ApiOperation(value = "财务数据--月度回款趋势", notes = "月度回款趋势")
    @RequestMapping(value = "/monthlyCollectionTrend", method = RequestMethod.GET)
    public WebResult monthlyCollectionTrend() {
        return success("ok", service.getMonthlyCollectionTrend());
    }

    @ApiOperation(value = "财务数据--各客户累计回款/回款率排行", notes = "各客户累计回款/回款率排行")
    @RequestMapping(value = "/customerCollectionRate", method = RequestMethod.GET)
    public WebResult customerCollectionRate() {
        return success("ok",service.customerCollectionRate());

    }

    @ApiOperation(value = "财务数据--采购量", notes = "采购量")
    @RequestMapping(value = "/purchaseVolume/{timeType}", method = RequestMethod.GET)
    public WebResult purchaseVolume(@ApiParam(value = "时间类型")@PathVariable String timeType) {

        return success("ok",service.getPurchaseVolume(timeType));
    }
    @ApiOperation(value = "财务数据--采购成本", notes = "采购成本")
    @RequestMapping(value = "/purchaseCost/{timeType}", method = RequestMethod.GET)
    public WebResult purchaseCost(@ApiParam(value = "时间类型")@PathVariable String timeType) {
        return success("ok",service.getPurchaseCost(timeType));

    }

    @ApiOperation(value = "财务数据--月度购进趋势", notes = "月度购进趋势")
    @RequestMapping(value = "/purchaseTrend", method = RequestMethod.GET)
    public WebResult purchaseTrend() {
        return success("ok",service.getPurchaseTrend());
    }

    @ApiOperation(value = "财务数据--应付款/实付情况", notes = "应付款/实付情况")
    @RequestMapping(value = "/paymentSituation", method = RequestMethod.GET)
    public WebResult paymentSituation() {
        return success("ok",service.getPaymentSituation());
    }

    @ApiOperation(value = "财务数据--月度付款趋势", notes = "月度付款趋势")
    @RequestMapping(value = "/monthlyPayment", method = RequestMethod.GET)
    public WebResult monthlyPayment() {
        return success("ok",service.getMonthlyPayment());
    }

    @ApiOperation(value = "财务数据--供应商累计应付款/应付率排行TOP10", notes = "供应商累计应付款/应付率排行TOP10")
    @RequestMapping(value = "/selectPenceRate", method = RequestMethod.GET)
    public WebResult selectPenceRate() {
        return success("ok",service.selectPenceRate());
    }

}